<template>
	<view class="content-box" :style="{ paddingTop: `${boxHeight}` }">
		<pub-head headerName="gamewt_game_record_more" :headerConfig="headerConfig"></pub-head>

		<z-paging ref="Zpaging" class="lis_srcoll_div" v-model="dataList" @query="getList" :refresher-enabled="false"
			:fixed="false" :style="{ height: `calc(100vh - ${boxHeight})` }">
			<view class="safe-bottom" style="padding: 0 20rpx 0;box-sizing: border-box;">
				<battleRecord :lists="dataList"></battleRecord>
			</view>
		</z-paging>

	</view>
</template>

<script>
import battleRecord from '../components/battle-record/battle-record'
import {
	requestGet,
	requestPost
} from '../common/util.js'
export default {
	components: {
		battleRecord
	},
	data() {
		return {
			headerConfig: {
				title: '参与记录',//标题栏内容
				left_type: 3,
				left_content:'white',
				title_color: '#fff',
				header_color: 'rgba(0,0,0,0)'
			},
			loading: false,
			page: 1,
			limit: 10,
			isOver: false,
			lists: [],

			dataList: []
		};
	},
	computed: {
		boxHeight: function () {
			return (this.$gameStore.NavHeight + 50 + 10) + 'px';
		},
	},
	onLoad() {
		// this.getList()
		setTimeout(() => {
			this.$comFun.openLoading();
			this.$refs.Zpaging.reload()
		}, 400);
	},

	methods: {
		lower() {
			this.getList()
		},
		async getList(pageNo, pageSize) {
			const res = await this.$request.get('game/record2', {
				pageNo: pageNo,
				pageSize: pageSize,
			});
			this.$comFun.closeLoading();
			// console.log(res);
			if (res.code == 200) {
				this.$refs.Zpaging.complete(res.result);
			} else {
				this.$refs.Zpaging.complete(false);
			}
		}
		// getList() {
		// 	if (this.isOver) {
		// 		return
		// 	}
		// 	this.loading = true;
		// 	let params = {
		// 		page: this.page,
		// 		limit: this.limit,
		// 	}
		// 	requestGet(this.$comFun.baseURL + 'xw/api/BattleRabbit/record2', params, true, false).then(res => {
		// 		this.loading = false;
		// 		console.log(res)
		// 		if (res.code == 200) {
		// 			if (this.page == 1) {
		// 				this.lists = res.result
		// 			} else {
		// 				this.lists = [...this.lists, ...res.result]
		// 			}
		// 			if (res.result.length < this.limit) {
		// 				this.isOver = true
		// 			}
		// 			this.page++
		// 		}
		// 	})
		// }
	}
}
</script>

<style lang="scss" scoped>
.content-box {
	position: relative;
	width: 100vw;
	min-height: 100vh;
	background: url('../static/game/bg_betting_record.png') center no-repeat;
	background-size: 100% 100%;
	background-attachment: fixed;
}
</style>